<template>
  <div 
    :class="[
      'bx-comment',
      'bx-glass'
    ]"
  >
    <div class="bx-comment__avatar">
      <slot name="avatar">
        <BxAvatar v-if="avatar" :image="avatar" size="medium" />
      </slot>
    </div>
    <div class="bx-comment__content">
      <div class="bx-comment__author">
        <slot name="author">
          <span class="bx-comment__author-name">{{ author }}</span>
        </slot>
        <span v-if="datetime" class="bx-comment__datetime">{{ datetime }}</span>
      </div>
      <div class="bx-comment__text">
        <slot>{{ content }}</slot>
      </div>
      <div v-if="$slots.actions" class="bx-comment__actions">
        <slot name="actions"></slot>
      </div>
      <div v-if="$slots.reply" class="bx-comment__reply">
        <slot name="reply"></slot>
      </div>
    </div>
  </div>
</template>

<script>
import BxAvatar from '../data-display/BxAvatar.vue'

export default {
  name: 'BxComment',
  components: {
    BxAvatar
  },
  props: {
    avatar: {
      type: String,
      default: ''
    },
    author: {
      type: String,
      default: ''
    },
    datetime: {
      type: String,
      default: ''
    },
    content: {
      type: String,
      default: ''
    }
  }
}
</script>

<style scoped>
.bx-comment {
  display: flex;
  padding: 16px;
  border-radius: var(--bx-radius-medium);
  font-family: var(--bx-font-family);
  color: var(--bx-text-primary);
}

.bx-comment__avatar {
  margin-right: 16px;
}

.bx-comment__content {
  flex: 1;
}

.bx-comment__author {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.bx-comment__author-name {
  font-weight: 600;
  margin-right: 8px;
}

.bx-comment__datetime {
  font-size: 12px;
  color: var(--bx-text-tertiary);
}

.bx-comment__text {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.bx-comment__actions {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--bx-text-secondary);
}

.bx-comment__reply {
  margin-top: 16px;
  padding-left: 16px;
  border-left: 2px solid var(--bx-glass-border);
}

/* Responsive */
@media (max-width: 768px) {
  .bx-comment {
    padding: 12px;
  }
  .bx-comment__avatar {
    margin-right: 12px;
  }
  .bx-comment__author-name {
    font-size: 14px;
  }
  .bx-comment__datetime {
    font-size: 11px;
  }
  .bx-comment__text {
    font-size: 13px;
  }
  .bx-comment__actions {
    font-size: 12px;
  }
}
</style>

